package com.javaspeak.designpatterns.go4.behavioural.command;

/**
 * Specifies the RequestType. The RequestType can be retrieved from the Request
 * by the RequestProcessor.  Inside the RequestType is a reference to the
 * command to execute.
 *
 * @author John Dickerson
 */
public enum RequestType {

    // capitalises all the attributes
    CAPITALISE( new CapitaliseCommand() ),

    // sorts the keys in the map by the values
    SORT( new SortCommand() );

    // holds a reference to the command associated with this enum.  As the
    // reference is in an Enum the reference is a singleton.
    private Command command;


    /**
     * Private constructor of enum
     *
     * @param command the command to execute
     */
    private RequestType( Command command ){

        this.command = command;
    }


    public Command getCommand(){

        return this.command;
    }
}
